package com.lam.dormitory.mapper;

import com.lam.dormitory.entity.Role;
import com.lam.dormitory.entity.Student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lam.dormitory.vo.StudentVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lam
 * @since 2019-12-26
 */
public interface StudentMapper extends BaseMapper<Student> {
    /**
     * 根据stuNo,stuName,stuAge,stuSex,stuMajor,stuPhone查询学生集合
     * @param student
     * @return
     */
    List<StudentVo> selectByStudent(Student student);

    /**
     * 根据roleId查找学生情况
     * @param roleId
     * @return
     */
    List<Student> selectByRoleId(Long roleId);

    /**
     * 查询所有学生专业（无重复）
     * @return
     */
    @Select("select * from student group by stu_major")
    List<Student> selectMajor();

}
